package com.pospi.pospihold.util;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import com.ums.AppHelper;
import com.ums.synthpayplugin.SynthPayPluginActivity;

import org.json.JSONException;
import org.json.JSONObject;

public class BlankHelper {
    /**
     * @param context
     * @param amout
     *
     * 请求：
     *     {
     *         "appName":"str",    //应用名称-银行卡收款
     *         "transId":"str",   //业务名称-消费
     *         "transData":{      //传入数据
     *             "amt":"str",    //交易金额
     *             "extOrderNo":"str"     //外部订单号(非必需)
     *         }
     *     }
     *
     *     微信支付宝
     *     POS 通（中间有半角空格）
     *     POS通
     *
     *
     */
    public static void request(Activity context, String amout) {
        String transApp = "银行卡收款";
        String transType = "消费";
        JSONObject object = new JSONObject();
        try {
            object.put("amt", amout);
//            object.put("appName", "银行卡收款");
//            object.put("transId", "消费");
//            JSONObject ob = new JSONObject();
//            ob.put("amt", amout);
//            ob.put("extOrderNo", GetData.getYYMMDDhhmmss());
//            object.put("transData", ob);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        AppHelper.callTrans(context,transApp,transType,object);
//        Intent cashierPluginIntent = new Intent(context, SynthPayPluginActivity.class);
//        cashierPluginIntent.putExtra("transData", object.toString());//非必须
//        context.startActivityForResult(cashierPluginIntent, 1);
    }

    public static void requestScan(Activity context, String amout) {
        String transApp = "POS 通";
        String transType = "POS通";
        JSONObject object = new JSONObject();
        try {
            object.put("amt", amout);
//            object.put("appName", "银行卡收款");
//            object.put("transId", "消费");
//            JSONObject ob = new JSONObject();
//            ob.put("amt", amout);
//            ob.put("extOrderNo", GetData.getYYMMDDhhmmss());
//            object.put("transData", ob);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        AppHelper.callTrans(context,transApp,transType,object);
//        Intent cashierPluginIntent = new Intent(context, SynthPayPluginActivity.class);
//        cashierPluginIntent.putExtra("transData", object.toString());//非必须
//        context.startActivityForResult(cashierPluginIntent, 1);
    }
}
